<template>
	<view class="content" style="min-height: 100vh;background: #FFFFFF;">
		<view style="padding: 20rpx;">
			<view class="display-flex space-between align-items">
				<view class="time display-flex align-items">
					<input type="text" class="font-size-26 file-1" placeholder="请输入卡片编号" />
					<view style="height: 26rpx;background: #2671CE;width: 1rpx;">

					</view>
					<view @click="datetimePicker.open()" class=" margin-left-20 margin-right-20 font-size-22 ">
						{{date}}
					</view>
					<view class="margin-right-10">
						<uv-icon name="arrow-down-fill" color="#2671CE" size="12"></uv-icon>
					</view>
				</view>
				<view style="padding: 20rpx;" class="button border-radius-12 color-FFF font-size-24">
					搜索
				</view>
			</view>
			<view v-for="item,index in list" @click="navigateTo('/pages/my/Cardopeningdynamicdetails/Cardopeningdynamicdetails?id=' + item.table_id)" :key="index" class="">
				<view class="display-flex space-between" style="padding:20rpx 0;">
					<view class="font-size-26 file-1 webkit-line-clamp" style="-webkit-line-clamp: 1;">
						{{item.msg}}
					</view>
					<view style="color: #2671CE;" class="margin-right-10 font-size-26">
						更多
					</view>
				</view>
				<uv-gap height="1" bgColor="#F5F5F5"></uv-gap>
			</view>
		</view>
		<uv-datetime-picker ref="datetimePicker" mode="date" :maxDate="Date.now()" @confirm="confirm">
		</uv-datetime-picker>
	</view>
</template>

<script setup>
	import {
		ref,
		reactive
	} from 'vue';
	import {
		onLoad,
		onShow,
		onReady,
		onReachBottom
	} from '@dcloudio/uni-app';
	import {
		nativeUI,
		navigateTo,
		navigateBack,
		timestampToDate
	} from '@/utils/index.js';
	import * as api from '@/request/app.js'; // 引入api 方法
	import local from '@/utils/localStorage.js'; //引入本地存储方法
	const date = ref(timestampToDate(Date.now(), 'Y/m/d'))
	const datetimePicker = ref(null)
	//分页
	const pagingState = ref(false)
	const page = ref(1)
	const list = ref([])
	onLoad(function(option) {
		card_open_log()
	});
	onShow(function() {});
	async function card_open_log() {
		if (!pagingState.value) {
			const {
				code,
				data
			} = await api.card_open_log({
				page: page.value
			})
			list.value = list.value.concat(data.data)
			if (data.current_page == data.last_page) {
				pagingState.value = true
				return
			}
			page.value++
		}
	}
	onReady(function() {});
	onReachBottom(function() {
		card_open_log()
	});
</script>

<style scoped lang="scss">
	.time {
		padding: 20rpx;
		background: #FFFFFF;
		border-radius: 8rpx;
		border: 1px solid #C3DAFC;
	}
</style>